/*
 *@Author: 张楚
 *@Date: 2021-08-10 10:39:54
 *@Description: List的专项练习
*/
import 'dart:math';

import 'package:flutter/material.dart';

class PracticeListPage extends StatefulWidget {
  const PracticeListPage({Key key}) : super(key: key);
  @override
  _PracticeListPageState createState() => _PracticeListPageState();
}

class _PracticeListPageState extends State<PracticeListPage> {
  List sorceList = [
    '1',
    '2',
    '1',
    '2',
    '1',
    '2',
  ];
  Map myMap = {'age': 14, 'height': 187, 'name': 'lucy'};
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('List的专项练习'),
      ),
      body: Container(
          alignment: Alignment.center,
          child: SingleChildScrollView(
            child:
                //   Column(
                //     mainAxisAlignment: MainAxisAlignment.start,
                //     children: List.generate(
                //       sorceList.length,
                //       (index) => Text(
                //         '${sorceList[index]}',
                //         style: Theme.of(context).textTheme.headline2,
                //       ),
                //     ),
                //   ),
                // ),

                //     ListView.builder(
                //   itemCount: sorceList.length,
                //   itemBuilder: (BuildContext context, int i) => Text('${sorceList[i]}'),
                // ),

                Column(
              children: [
                ElevatedButton(
                    onPressed: () {
                      var newList = sorceList.map((v) {
                        return {'$v+dad'};
                      });

                      print(newList);
                      newList.forEach((element) {
                        print(element);
                      });
                    },
                    child: Text('点击打印 ')),
                FractionallySizedBox(
                  heightFactor: 0.5,
                  widthFactor: 0.5,
                )
              ],
            ),
          )),
    );
  }
}
